<?php
class City_model extends Model {
	function create() {
		$data = array(
			'name' => $this->input->post('name')
		);
		$this->db->insert('cities', $data);
	}

	function update($id) {
		$data = array(
			'name' => $this->input->post('name')
		);
		$this->db->update('cities', $data, array('id' => $id));
	}

	function readAll() {
		$query = $this->db->get('cities');
		return $query->result();
	}

	function read($id) {
		$query = $this->db->getwhere('cities', array('id' => $id));
		return $query->row();
	}
}
?>
